`timescale 1ns/1ps
module CompareCurrentDay(PM, Day, access);

input [1:0] PM;
input [2:0] Day;
output access;

wire [1:0] PM;
wire [2:0] Day;
reg access;

task daycompare;
  begin
    if (PM==01)  //Mode 01 means access every day from 7am to 12pm

    begin
  
      access <= 1'b1;
  
    end
    else if (PM==10)   // mode 10 means access only in the weekdays 
  
    begin
  
    if(Day < 110)   // The days of the week are defined from 1-7. Starting from Mon to Sun
      
      begin
    
        access <= 1'b1; //Access is only given is value is less that 110, which is defined as Saturday
      
      end
    else
     
      begin
      
        access <= 1'b0;
        
      end
      
    end
    else 
    
    begin
    
      access <= 1'b1;    //Access is allowed in any other given mode. 
    
    end
  end
  endtask;
endmodule; 

